/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.belf.console.domain.entity;

import java.util.HashMap;
import java.util.Map;

/**
 * 定义各种数据库类型
 */
public class DatabaseIdentifier {
    public static final String DB_2 = "DB2";
    public static final String DAMENG = "DAMENG";
    public static final String GBASE_8S = "GBASE_8S";
    public static final String HIVE = "HIVE";
    public static final String INFORMIX = "INFORMIX";
    public static final String KINGBASE = "KINGBASE";
    public static final String MYSQL = "MYSQL";
    public static final String ORACLE = "ORACLE";
    public static final String POSTGRESQL = "POSTGRES";
    public static final String SQLSERVER = "SQLSERVER";
    public static final String OCEANBASE = "OCEANBASE";
    public static final String TIDB = "TiDB";
    public static final String SHENTONG = "SHENTONG";
    public static final String GAUSSDB = "GAUSSDB";
    public static final String OPENGAUSS = "OPENGAUSS";
    public static final String POLARDB = "POLARDB";
    public static final String GOLDENDB = "GOLDENDB";
    public static final String TSQL = "TSQL";
    public static final String HIGHGO = "HIGHGO";

    public static final Map<String, String> DB_NAME_MAPPINGS = new HashMap<>();

    static {
        DB_NAME_MAPPINGS.put(DB_2, "DB2");
        DB_NAME_MAPPINGS.put(DAMENG, "达梦");
        DB_NAME_MAPPINGS.put(GBASE_8S, "南大通用GBase");
        DB_NAME_MAPPINGS.put(HIVE, "Hive");
        DB_NAME_MAPPINGS.put(INFORMIX, "Informix");
        DB_NAME_MAPPINGS.put(KINGBASE, "金仓Kingbase");
        DB_NAME_MAPPINGS.put(MYSQL, "MySQL");
        DB_NAME_MAPPINGS.put(POSTGRESQL, "PostgreSQL");
        DB_NAME_MAPPINGS.put(SQLSERVER, "SQL Server");
        DB_NAME_MAPPINGS.put(OCEANBASE, "OceanBase");
        DB_NAME_MAPPINGS.put(TIDB, "TiDB");
        DB_NAME_MAPPINGS.put(SHENTONG, "神通");
        DB_NAME_MAPPINGS.put(POLARDB, "PolarDB");
        DB_NAME_MAPPINGS.put(GOLDENDB, "中兴GoldenDB");
        DB_NAME_MAPPINGS.put(TSQL, "腾讯TSQL");
        DB_NAME_MAPPINGS.put(HIGHGO, "翰高HighGo");
    }

    public static String name(String dbIdentifier) {
        if (DB_NAME_MAPPINGS.containsKey(dbIdentifier)) {
            return DB_NAME_MAPPINGS.get(dbIdentifier);
        }
        return dbIdentifier;
    }

}
